/*
 * @lc app=leetcode.cn id=717 lang=javascript
 *
 * [717] 1比特与2比特字符
 */

// @lc code=start
/**
 * @param {number[]} bits
 * @return {boolean}
 */
var isOneBitCharacter = function(bits) {
    bits.pop()
    let temp=bits.lastIndexOf(0)
    let arrLen=bits.length-temp-1
    return arrLen%2==0
};
// @lc code=end

var isOneBitCharacter = function(bits, i = 0) {
    while (i < bits.length - 1) i += bits[i] + 1
    return i === bits.length - 1
};
